%This graph program is the replication code for Figure 5, based on
%simulations of Simulate_Concentration_HighACOLNSDF_func.m. The variable nu
%represents the adjustment cost parameter (in place of the varphi notation
%used in the paper). The range of adjustment costs is much higher than the
%adjustment cost parametereized in the quantitative model in Section 4.

clear;
clc;
close all;

set(groot,'defaulttextinterpreter','latex');
set(groot,'defaultAxesTickLabelInterpreter','latex');
set(groot,'defaultLegendInterpreter','latex');


%% Color Scheme
co = [   0    0.4470    0.7410;
    0.8500    0.3250    0.0980;
    0.9290    0.6940    0.1250;
    0.4940    0.1840    0.5560;
    0.4660    0.6740    0.1880;
    0.3010    0.7450    0.9330;
    0.6350    0.0780    0.1840];

co2 = [   0         0    1.0000;
    0    0.5000         0;
    1.0000         0         0;
    0    0.7500    0.7500;
    0.7500         0    0.7500;
    0.7500    0.7500         0;
    0.2500    0.2500    0.2500];

variable_N = 2:1:8;
variable_nu = 15:0.5:30;



for j = 1:length(variable_N)
    for k = 1:length(variable_nu)
        nu_rp(j,k) = Simulate_Concentration_HighACOLNSDF_func(variable_N(j), variable_nu(k));
        n_nu_graph(j,k) = variable_N(j);
        nu_graph(j,k) = variable_nu(k);
    end
end


%------------------------variable N and o------------------------------
rp = nu_rp;

clc;
surf(n_nu_graph,nu_graph,100*rp);
zlabel('Mean Returns (%)', 'interpreter', 'latex')
xlabel('Number of Firms', 'interpreter', 'latex')
ylabel('Adjustment Costs', 'interpreter', 'latex')
set(gca,'FontSize',15)
set(gcf, 'Position', [300 300 1200 540])


%for jpeg
f = gcf;
set(f, 'Position', [298   180   691   586]);
ax = gca;
ax.YLabel.Rotation = 335;
ax.XLabel.Rotation = 15;
exportgraphics(f,strcat('Figure',num2str(5),'.jpg'),'BackgroundColor','none')










